﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 4.2
// Code is generated on: 
// Code is generated using templates: SD.TemplateBindings.SharedTemplates
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using VNet.VisiSuite.Dal;
using VNet.VisiSuite.Dal.FactoryClasses;
using VNet.VisiSuite.Dal.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace VNet.VisiSuite.Dal.RelationClasses
{
	/// <summary>Implements the relations factory for the entity: Operator. </summary>
	public partial class OperatorRelations
	{
		/// <summary>CTor</summary>
		public OperatorRelations()
		{
		}

		/// <summary>Gets all relations of the OperatorEntity as a list of IEntityRelation objects.</summary>
		/// <returns>a list of IEntityRelation objects</returns>
		public virtual List<IEntityRelation> GetAllRelations()
		{
			List<IEntityRelation> toReturn = new List<IEntityRelation>();
			toReturn.Add(this.BraiderProductEntityUsingOperatorId);
			toReturn.Add(this.OperatorAuthEntityUsingOperatorId);
			toReturn.Add(this.ProductionHistoryEntityUsingOperatorId);
			toReturn.Add(this.AreaEntityUsingAreaId);
			return toReturn;
		}

		#region Class Property Declarations

		/// <summary>Returns a new IEntityRelation object, between OperatorEntity and BraiderProductEntity over the 1:n relation they have, using the relation between the fields:
		/// Operator.OperatorId - BraiderProduct.OperatorId
		/// </summary>
		public virtual IEntityRelation BraiderProductEntityUsingOperatorId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "BraiderProducts" , true);
				relation.AddEntityFieldPair(OperatorFields.OperatorId, BraiderProductFields.OperatorId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("OperatorEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("BraiderProductEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between OperatorEntity and OperatorAuthEntity over the 1:n relation they have, using the relation between the fields:
		/// Operator.OperatorId - OperatorAuth.OperatorId
		/// </summary>
		public virtual IEntityRelation OperatorAuthEntityUsingOperatorId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "OperatorAuths" , true);
				relation.AddEntityFieldPair(OperatorFields.OperatorId, OperatorAuthFields.OperatorId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("OperatorEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("OperatorAuthEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between OperatorEntity and ProductionHistoryEntity over the 1:n relation they have, using the relation between the fields:
		/// Operator.OperatorId - ProductionHistory.OperatorId
		/// </summary>
		public virtual IEntityRelation ProductionHistoryEntityUsingOperatorId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "ProductionHistories" , true);
				relation.AddEntityFieldPair(OperatorFields.OperatorId, ProductionHistoryFields.OperatorId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("OperatorEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProductionHistoryEntity", false);
				return relation;
			}
		}


		/// <summary>Returns a new IEntityRelation object, between OperatorEntity and AreaEntity over the m:1 relation they have, using the relation between the fields:
		/// Operator.AreaId - Area.AreaId
		/// </summary>
		public virtual IEntityRelation AreaEntityUsingAreaId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Area", false);
				relation.AddEntityFieldPair(AreaFields.AreaId, OperatorFields.AreaId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("AreaEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("OperatorEntity", true);
				return relation;
			}
		}
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; }
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSuperTypeRelation() { return null;}
		#endregion

		#region Included Code

		#endregion
	}
	
	/// <summary>Static class which is used for providing relationship instances which are re-used internally for syncing</summary>
	internal static class StaticOperatorRelations
	{
		internal static readonly IEntityRelation BraiderProductEntityUsingOperatorIdStatic = new OperatorRelations().BraiderProductEntityUsingOperatorId;
		internal static readonly IEntityRelation OperatorAuthEntityUsingOperatorIdStatic = new OperatorRelations().OperatorAuthEntityUsingOperatorId;
		internal static readonly IEntityRelation ProductionHistoryEntityUsingOperatorIdStatic = new OperatorRelations().ProductionHistoryEntityUsingOperatorId;
		internal static readonly IEntityRelation AreaEntityUsingAreaIdStatic = new OperatorRelations().AreaEntityUsingAreaId;

		/// <summary>CTor</summary>
		static StaticOperatorRelations()
		{
		}
	}
}
